package com.budwk.app.sqfwV2.enums.weiqingmen;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 入户调查
 */
@Getter
public enum HouseHoldSurveyEnum {
    // excel start ----
    SIX_PERSONNEL("1", "六类人员",
            "六类人员台账", "【六类人员】台账",
            "六类人员台账模板", "excel", "/preview/rh/SixPersonnel.png"),
    NINE_PERSONNEL("2", "九类人员",
            "九类人员巡查台账", "【九类人员巡查】台账",
            "九类人员巡查台账模板", "excel", "/preview/rh/NinePersonnel.png"),

    // excel end ----

    // pdf start ----
    PERSONNEL_INSPECTION("3", "人员巡查",
            "人员巡查记录台账", "【人员巡查记录台账】合集",
            "人员巡查记录模板", "pdf", "/preview/rh/PersonnelInspection.png"),

    // pdf end ----
    ;

    private String code;
    private String name;
    private String oneName;
    private String compilationName;
    private String templateName;
    private String fileType;
    private String img;

    HouseHoldSurveyEnum(String code, String name, String oneName, String compilationName, String templateName, String fileType, String img) {
        this.name = name;
        this.code = code;
        this.oneName = oneName;
        this.compilationName = compilationName;
        this.templateName = templateName;
        this.fileType = fileType;
        this.img = img;
    }

    public static String getName(String code) {
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getName();
            }
        }
        return null;
    }

    public static String getOneName(String code) {
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getOneName();
            }
        }
        return null;
    }

    public static String getCompilationName(String code) {
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getCompilationName();
            }
        }
        return null;
    }

    public static String getTemplateName(String code) {
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getTemplateName();
            }
        }
        return null;
    }

    public static HouseHoldSurveyEnum getEnum(String code) {
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getCode().equals(code)) {
                return o;
            }
        }
        return null;
    }

    public static List<HouseHoldSurveyEnum> getPdf() {
        List<HouseHoldSurveyEnum> list = new ArrayList<>();
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getFileType().equals("pdf")) {
                list.add(o);
            }
        }
        return list;
    }

    public static List<HouseHoldSurveyEnum> getExcel() {
        List<HouseHoldSurveyEnum> list = new ArrayList<>();
        for (HouseHoldSurveyEnum o : HouseHoldSurveyEnum.values()) {
            if (o.getFileType().equals("excel")) {
                list.add(o);
            }
        }
        return list;
    }
}
